#include "widget.h"
#include "ui_widget.h"
#include <QButtonGroup>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    //使用QButtonGroup 对单选按钮分组,对组和组之间取消 排他
    QButtonGroup* group1=new QButtonGroup(this);
    QButtonGroup* group2=new QButtonGroup(this);
    QButtonGroup* group3=new QButtonGroup(this);

    //把上述单选按钮，放到不同的组里
    group1->addButton(ui->radioButton);
    group1->addButton(ui->radioButton_2);
    group1->addButton(ui->radioButton_3);

    group2->addButton(ui->radioButton_4);
    group2->addButton(ui->radioButton_5);
    group2->addButton(ui->radioButton_6);

    group3->addButton(ui->radioButton_7);
    group3->addButton(ui->radioButton_8);
    group3->addButton(ui->radioButton_9);

}

Widget::~Widget()
{
    delete ui;
}
